import Taro from '@tarojs/taro'
import { View } from "@tarojs/components"
import './index.less'

const WowSignInModal = props => {

  const close = () => {
    props.close && props.close()
  }

  const goMy = () => {
    Taro.switchTab({
      url: '/pages/my/index',
      success: close
    })
  }

  return (
    props.show ?
      (
        <View className="mask">
          <View className={[
            'sign-in-modal',
            props.info.code === 0 ? 'success' : 'fail'
          ].join(' ')}>
            <View className="msg">签到{props.info.code === 0 ? '成功' : '失败'}</View>
            <View className="text">
              {props.info.code === 0 ? '获得 10 益豆' : '今日已签'}
            </View>
            <View className="text">当前累计2500益豆</View>
            <View className="go-back-btn" onClick={close}>点击返回</View>
            <View className="my" onClick={goMy}>查看我的信息&nbsp;&gt;</View>
          </View>
        </View>
      ) : ''
  )
}

export default WowSignInModal
